package com.wpen.unit.web.controller.job;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wpen.unit.service.job.JobInfoService;
import com.wpen.unit.web.dto.job.JobInfoAddRequest;
import com.wpen.unit.web.dto.job.JobInfoAddResponse;
import com.wpen.unit.web.dto.job.JobInfoListRequest;
import com.wpen.unit.web.dto.job.JobInfoListResponse;
import com.wpen.unit.web.dto.job.JobInfoModRequest;
import com.wpen.unit.web.dto.job.JobInfoModResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 任务作业维护
 * 
 * @author pg
 *
 */
@Tag(name = "任务作业模块服务接口")
@RestController
@RequestMapping("/api")
public class JobInfoController {
    @Autowired
    private JobInfoService jobInfoService;

    @Operation(summary = "任务作业-列表查询")
    @PostMapping(value = "/jobInfo/list",produces = MediaType.APPLICATION_JSON_VALUE)
    public JobInfoListResponse queryListJobInfo(@RequestBody @Valid JobInfoListRequest jobInfoListRequest ) {
        return jobInfoService.queryListJobInfo(jobInfoListRequest);
    }

    @Operation(summary = "任务作业-新增")
    @PostMapping(value = "/jobInfo/add",produces = MediaType.APPLICATION_JSON_VALUE)
    public JobInfoAddResponse addJobInfo(@RequestBody @Valid JobInfoAddRequest jobInfoAddRequest ) {
        return jobInfoService.addJobInfo(jobInfoAddRequest);
    }


    @Operation(summary = "任务作业-修改")
    @PostMapping(value = "/jobInfo/mod",produces = MediaType.APPLICATION_JSON_VALUE)
    public JobInfoModResponse modJobInfo(@RequestBody @Valid JobInfoModRequest jobInfoModRequest ) {
        return jobInfoService.modJobInfo(jobInfoModRequest);
    }


}
